<template>
  <div class="firstpageContentstyle">
    <!-- 标题 -->
    <h2>{{ datas.text }}</h2>
    <p style="color: #d40000; font-size: 14px">布局预览</p>
    <p style="color: #969799; font-size: 12px; margin: 5px 0"> 选定布局区域，在下方上传内容 </p>

    <!-- 图片布局 -->
    <!-- 一行一个 -->
    <section class="buju buju5" v-show="datas.commodityType === 0">
      <div
        @click="imgActive = 0"
        class="commodityType commodityType0"
        style="width: 325px; height: 163px"
        :class="[0 === imgActive ? 'active' : '']">
        <div style="font-size: 12px" v-if="!datas.imageList[0].src"> 363x272像素<br />或同等比例 </div>
        <img draggable="false" v-else :src="datas.imageList[0].src" alt="" />
      </div>
    </section>

    <!-- 一行二个 -->
    <section class="buju buju0" v-show="datas.commodityType === 1">
      <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
        <transition-group>
          <div
            @click="imgActive = index - 1"
            v-for="index in 2"
            :key="index"
            class="commodityType1 commodityType"
            :class="[index - 1 === imgActive ? 'active' : '']">
            <div style="font-size: 12px" v-if="!datas.imageList[index - 1].src"> 宽度174像素 </div>
            <img draggable="false" v-else :src="datas.imageList[index - 1].src" alt="" />
          </div>
        </transition-group>
      </vuedraggable>
    </section>

    <!-- 一左二右 -->
    <section class="buju buju4" v-show="datas.commodityType === 2">
      <div
        @click="imgActive = 0"
        class="commodityType3 commodityType"
        style="width: 153px; height: 269px"
        :class="[0 === imgActive ? 'active' : '']">
        <div style="font-size: 12px" v-if="!datas.imageList[0].src"> 174x272像素<br />或同等比例 </div>
        <img draggable="false" v-else :src="datas.imageList[0].src" alt="" />
      </div>
      <div style="display: inline-flex; flex-direction: column; width: 157px">
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index"
              class="commodityType3 commodityType"
              :class="[index === imgActive ? 'active' : '']"
              v-for="index in 2"
              :key="index">
              <div style="font-size: 12px" v-if="!datas.imageList[index].src"> 174x129像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
    </section>

    <!-- 二左一右-->
    <section class="buju buju4" v-show="datas.commodityType === 3">
      <div style="display: inline-flex; flex-direction: column; width: 157px">
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index - 1"
              class="commodityType3 commodityType"
              :class="[index - 1 === imgActive ? 'active' : '']"
              v-for="index in 2"
              :key="index">
              <div style="font-size: 12px" v-if="!datas.imageList[index - 1].src"> 174x129像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index - 1].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
      <div
        @click="imgActive = 2"
        class="commodityType3 commodityType"
        style="width: 153px; height: 269px"
        :class="[2 === imgActive ? 'active' : '']">
        <div style="font-size: 12px" v-if="!datas.imageList[2].src"> 174x272像素<br />或同等比例 </div>
        <img draggable="false" v-else :src="datas.imageList[2].src" alt="" />
      </div>
    </section>

    <!-- 二左二右 -->
    <section class="buju buju0" v-show="datas.commodityType === 4">
      <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
        <transition-group>
          <div
            @click="imgActive = index - 1"
            v-for="index in 4"
            :key="index"
            class="commodityType2 commodityType"
            :class="[index - 1 === imgActive ? 'active' : '']">
            <div style="font-size: 12px" v-if="!datas.imageList[index - 1].src"> 174x129像素<br />或同等比例 </div>
            <img draggable="false" v-else :src="datas.imageList[index - 1].src" alt="" />
          </div>
        </transition-group>
      </vuedraggable>
    </section>

    <!-- 一左三右 -->
    <section class="buju buju4" v-show="datas.commodityType === 5">
      <!-- 第一张图片 -->
      <div
        @click="imgActive = 0"
        class="commodityType4 commodityType"
        style="width: 163px; height: 325px"
        :class="[0 === imgActive ? 'active' : '']">
        <div style="font-size: 12px" v-if="!datas.imageList[0].src"> 147x272像素<br />或同等比例 </div>
        <img draggable="false" v-else :src="datas.imageList[0].src" alt="" />
      </div>
      <div style="display: inline-flex; flex-direction: column; width: 157px">
        <!-- 第二张图片 -->
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index"
              class="commodityType4 commodityType"
              :class="[index === imgActive ? 'active' : '']"
              v-for="index in 3"
              :key="index">
              <div style="font-size: 12px" v-if="!datas.imageList[index].src"> 174x82像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
    </section>

    <!-- 三左一右 -->
    <section class="buju buju4" v-show="datas.commodityType === 6">
      <div style="display: inline-flex; flex-direction: column; width: 157px">
        <!-- 第二张图片 -->
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index - 1"
              class="commodityType4 commodityType"
              :class="[index - 1 === imgActive ? 'active' : '']"
              v-for="index in 3"
              :key="index">
              <div style="font-size: 12px" v-if="!datas.imageList[index - 1].src"> 174x82像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index - 1].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
      <!-- 第一张图片 -->
      <div
        @click="imgActive = 3"
        class="commodityType4 commodityType"
        style="width: 163px; height: 325px"
        :class="[3 === imgActive ? 'active' : '']">
        <div style="font-size: 12px" v-if="!datas.imageList[3].src"> 147x272像素<br />或同等比例 </div>
        <img draggable="false" v-else :src="datas.imageList[3].src" alt="" />
      </div>
    </section>

    <!-- 二左三右 -->
    <section class="buju buju4" v-show="datas.commodityType === 7">
      <!-- 第一张图片 -->
      <div style="display: inline-flex; flex-direction: column">
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index - 1"
              v-for="index in 2"
              :key="index"
              class="commodityType8 commodityType"
              :class="[index - 1 === imgActive ? 'active' : '']">
              <div style="font-size: 12px" v-if="!datas.imageList[index - 1].src"> 174x129像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index - 1].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
      <div style="display: inline-flex; flex-direction: column">
        <!-- 第二张图片 -->
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index + 1"
              class="commodityType4 commodityType"
              :class="[index + 1 === imgActive ? 'active' : '']"
              v-for="index in 3"
              :key="index"
            >
              <div style="font-size: 12px" v-if="!datas.imageList[index + 1].src">
                174x82像素<br />或同等比例
              </div>
              <img
                draggable="false"
                v-else
                :src="datas.imageList[index + 1].src"
                alt=""
              />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
    </section>

    <!-- 三左二右 -->
    <section class="buju buju4" v-show="datas.commodityType === 8">
      <div style="display: inline-flex; flex-direction: column">
        <!-- 第二张图片 -->
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index - 1"
              class="commodityType4 commodityType"
              :class="[index - 1 === imgActive ? 'active' : '']"
              v-for="index in 3"
              :key="index">
              <div style="font-size: 12px" v-if="!datas.imageList[index - 1].src"> 174x82像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index - 1].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
      <!-- 第一张图片 -->
      <div style="display: inline-flex; flex-direction: column">
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index + 2"
              v-for="index in 2"
              :key="index"
              class="commodityType8 commodityType"
              :class="[index + 2 === imgActive ? 'active' : '']">
              <div style="font-size: 12px" v-if="!datas.imageList[index + 2].src"> 174x129像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index + 2].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
    </section>

    <!-- 二左三右2 -->
    <section class="buju buju4" v-show="datas.commodityType === 9">
      <!-- 第一张图片 -->
      <div style="display: inline-flex; flex-direction: column">
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index - 1"
              v-for="index in 2"
              :key="index"
              class="commodityType9 commodityType"
              :class="[index - 1 === imgActive ? 'active' : '']">
              <div style="font-size: 12px" v-if="!datas.imageList[index - 1].src"> 302x238像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index - 1].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
      <div style="display: inline-flex; flex-direction: column">
        <!-- 第二张图片 -->
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index + 1"
              class="commodityType4 commodityType"
              :class="[index + 1 === imgActive ? 'active' : '']"
              v-for="index in 3"
              :key="index">
              <div style="font-size: 12px" v-if="!datas.imageList[index + 1].src"> 302x112像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index + 1].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
    </section>

    <!-- 三左二右2 -->
    <section class="buju buju4" v-show="datas.commodityType === 10">
      <div style="display: inline-flex; flex-direction: column">
        <!-- 第二张图片 -->
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index - 1"
              class="commodityType4 commodityType"
              :class="[index - 1 === imgActive ? 'active' : '']"
              v-for="index in 3"
              :key="index">
              <div style="font-size: 12px" v-if="!datas.imageList[index - 1].src"> 302x112像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index - 1].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
      <!-- 第一张图片 -->
      <div style="display: inline-flex; flex-direction: column">
        <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
          <transition-group>
            <div
              @click="imgActive = index + 2"
              v-for="index in 2"
              :key="index"
              class="commodityType9 commodityType"
              :class="[index + 2 === imgActive ? 'active' : '']">
              <div style="font-size: 12px" v-if="!datas.imageList[index + 2].src"> 302x238像素<br />或同等比例 </div>
              <img draggable="false" v-else :src="datas.imageList[index + 2].src" alt="" />
            </div>
          </transition-group>
        </vuedraggable>
      </div>
    </section>

    <!-- 三左三右 -->
    <section class="buju buju0" v-show="datas.commodityType === 11">
      <vuedraggable v-model="datas.imageList" v-bind="dragOptions">
        <transition-group>
          <div
            @click="imgActive = index - 1"
            v-for="index in 6"
            :key="index"
            class="commodityType2 commodityType"
            :class="[index - 1 === imgActive ? 'active' : '']">
            <div style="font-size: 12px" v-if="!datas.imageList[index - 1].src"> 174x129像素<br />或同等比例 </div>
            <img draggable="false" v-else :src="datas.imageList[index - 1].src" alt="" />
          </div>
        </transition-group>
      </vuedraggable>
    </section>

    <p style="color: #d40000; font-size: 12px; margin-top: 10px">请上传图片</p>

    <!-- 表单 -->
    <el-form label-width="80px" :model="datas" size="small">
      <section
        class="magiccubestyleList"
        v-for="(item, index) in datas.imageList"
        :key="index"
        v-show="imgActive === index">
        <div style="display: flex; align-items: center;">
          <!-- 图片 -->
          <div class="imag">
            <div class="titpic">
              <p style="font-size: 14px; color:#666666">内容图片</p>
              <img draggable="false" @click="showUpload('titpic')" v-if="!item.src" src="../../../../assets/images/add.png" style="border: 1px solid #e5e5e5" alt="" />
              <div v-else style="position: relative" @click="showUpload('titpic')">
                <img draggable="false" :src="item.src" alt="" />
                <span>更换图片</span>
              </div>
            </div>
            <div class="videoimg" v-show="datas.commodityType === 4 || datas.commodityType === 10">
              <p style="font-size: 14px; color:#666666">缩略图</p>
              <img src="../../../../assets/images/add.png" @click="showUpload('slt')" alt draggable="false" v-if="!item.vimgUrl" />
              <img :src="item.vimgUrl" @click="showUpload('slt')" alt draggable="false" v-else />
            </div>
            <div class="upvideo" v-show="datas.commodityType === 4 || datas.commodityType === 10">
              <el-button v-if="!item.videoUrl" size="small" type="primary" @click="uploadVideo">
                上传视频
              </el-button>
              <div v-else>
                <video width="60" height="60" v-if="item.videoUrl" controls="controls">
                  <source :src="item.videoUrl" type="video/mp4" />
                </video>
                <p @click="deleteupvideo(index)">删除</p>
              </div>
            </div>
          </div>
          <!-- 标题和链接 -->
          <div class="imgText">
            <el-input
              v-model="item.name"
              placeholder="请输入应用名称"
              size="mini"
              clearable
              style="margin-bottom: 20px"
            />
            <el-input
              v-model="item.desc"
              placeholder="请输入应用描述"
              size="mini"
              clearable
              style="margin-bottom: 20px"
            />
            <!-- 选择类型 -->
            <select-link
              @selectThisLink="selectThisLink"
              :linktypeurl="item.url"
              :theIndex="index"
              @clearThisLink="clearThisLink(index)">
            </select-link>
            <div style="margin-bottom: 20px"></div>
            <el-form-item class="lef" label="VIP标识">
              {{ item.isVipShow ? "显示" : "隐藏" }}
              <el-checkbox v-model="item.isVipShow" />
            </el-form-item>
          </div>
        </div>
      </section>

      <div style="height: 20px" />

      <!-- 标题内容 -->
      <el-form-item label="选择模板" class="lef">
        <p style="color: #000; line-height: 1px">{{ styleText }}</p>
      </el-form-item>

      <!-- 样式选择 -->
      <div class="commodityType">
        <el-tooltip
          class="item"
          effect="dark"
          :content="item.content"
          placement="bottom"
          v-for="(item, index) in commodityTypes"
          :key="index">
          <img class="iconfont" :src="item.icon" @click="changeCommodityType(index)" />
        </el-tooltip>
      </div>

      <div style="height: 20px" />

      <!-- 页面边距 -->
      <el-form-item label="页面边距" class="lef">
        <el-slider v-model="datas.pageMargin" :max="20" input-size="mini" show-input></el-slider>
      </el-form-item>

      <!-- 图片间隙 -->
      <el-form-item label="图片间隙" class="lef">
        <el-slider v-model="datas.imgMargin" :max="20" input-size="mini" show-input></el-slider>
      </el-form-item>
    </el-form>

    <!-- 上传图片 -->
    <uploadimg ref="upload" @uploadInformation="uploadInformation" />
    <!-- 上传视频 -->
    <uploadVideo ref="uploadvideo" @uploadVideoSrc="uploadVideoSrc" />
  </div>
</template>

<script>
import vuedraggable from "vuedraggable"; // 拖拽组件
import uploadimg from "../../../uploadImg"; // 图片上传
import SelectLink from "../../../selectLink";
import uploadVideo from "../../../uploadVideo"; // 视频上传
export default {
  name: "firstpageContentstyle",
  props: {
    datas: Object,
  },
  components: {
    vuedraggable,
    uploadimg,
    uploadVideo,
    SelectLink
  },
  data() {
    return {
      dragOptions: {
        // 拖拽配置
        animation: 200,
      },
      commodityTypes: [
        {
          icon: require("../../../../assets/img/zxicon1.png"),
          type: 0,
          content: "一行一个",
        },
        {
          icon: require("../../../../assets/img/zxicon2.png"),
          type: 1,
          content: "一行二个",
        },
        {
          icon: require("../../../../assets/img/zxicon3.png"),
          type: 2,
          content: "一左二右",
        },
        {
          icon: require("../../../../assets/img/zxicon4.png"),
          type: 3,
          content: "二左一右",
        },
        {
          icon: require("../../../../assets/img/zxicon7.png"),
          type: 4,
          content: "二左二右",
        },
        {
          icon: require("../../../../assets/img/zxicon5.png"),
          type: 5,
          content: "一左三右",
        },
        {
          icon: require("../../../../assets/img/zxicon6.png"),
          type: 6,
          content: "三左一右",
        },
        {
          icon: require("../../../../assets/img/zxicon8.png"),
          type: 7,
          content: "二左三右",
        },
        {
          icon: require("../../../../assets/img/zxicon9.png"),
          type: 8,
          content: "三左二右",
        },
        {
          icon: require("../../../../assets/img/zxicon8.png"),
          type: 9,
          content: "二左三右2",
        },
        {
          icon: require("../../../../assets/img/zxicon9.png"),
          type: 10,
          content: "三左二右2",
        },
        {
          icon: require("../../../../assets/img/zxicon10.png"),
          type: 11,
          content: "三左三右",
        }
      ],
      imgActive: 0, //默认选中第一个图片
      emptyText: "",
      changeType: ''
    };
  },
  computed: {
    styleText() {
      this.imgActive = 0;
      if (this.datas.commodityType === 0) return "一行一个";
      if (this.datas.commodityType === 1) return "一行二个";
      if (this.datas.commodityType === 2) return "一左二右";
      if (this.datas.commodityType === 3) return "二左一右";
      if (this.datas.commodityType === 4) return "二左二右";
      if (this.datas.commodityType === 5) return "一左三右";
      if (this.datas.commodityType === 6) return "三左一右";
      if (this.datas.commodityType === 7) return "二左三右";
      if (this.datas.commodityType === 8) return "三左二右";
      if (this.datas.commodityType === 9) return "二左三右2";
      if (this.datas.commodityType === 10) return "三左二右2";
      if (this.datas.commodityType === 11) return "三左三右";
    },
  },
  methods: {
    changeCommodityType(index) {
      this.datas.commodityType = index;
      // if (index === 3) {
      //   // 保存第一个元素
      //   let firstElement = this.datas.imageList.shift();
      //   // 在第三个位置插入第一个元素
      //   this.datas.imageList.splice(2, 0, firstElement);
      // }
    },
    showUpload(type) {
      this.changeType = type;
      this.$refs.upload.showUpload();
    },
    uploadInformation(res) {
      if (this.changeType && this.changeType === 'slt') {
        this.datas.imageList[this.imgActive].vimgUrl = res;
      } else {
        this.datas.imageList[this.imgActive].src = res;
      }
    },
    uploadVideo() {
      this.$refs.uploadvideo.showUpload();
    },
    uploadVideoSrc(url) {
      this.datas.imageList[this.imgActive].videoUrl = url;
    },
    // 删除视频
    deleteupvideo(index) {
      this.datas.imageList[index].videoUrl = '';
    },
    // 选择链接
    selectThisLink(resu) {
      this.datas.imageList.forEach((it, ind) => {
        if (ind == resu.index) {
          it.url = resu.url;
          it.name = resu.name;
          it.desc = resu.note;
          it.id = resu.id;
        }
      });
    },
    clearThisLink (index) {
      this.datas.imageList[index].url = '';
    },
  },
};
</script>

<style scoped lang="scss">
.firstpageContentstyle {
  width: 100%;
  position: absolute;
  left: 0;
  overflow: hidden;
  top: 0;
  padding: 0 10px 20px;
  box-sizing: border-box;
  /* 标题 */
  h2 {
    padding: 24px 16px 24px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #f2f4f6;
    font-size: 18px;
    font-weight: 600;
    color: #323233;
  }

  /* 布局 */
  .buju {
    &.buju0 {
      display: flex;
      justify-content: space-around;
      flex-wrap: wrap;
    }
    &.buju4 {
      display: inline-flex;
      flex-direction: row;
      justify-content: space-around;
    }
    .active {
      background: #e0edff;
      border: 1px solid #155bd4;
      color: #155bd4;
      z-index: 2;
    }
    .commodityType {
      background-color: #fff;
      border: 1px solid #ebedf0;
      display: inline-flex;
      justify-content: center;
      align-items: center;
      color: #7d7e80;
      cursor: pointer;
      &.active {
        background: #e0edff;
        border: 1px solid #155bd4;
        color: #155bd4;
        z-index: 2;
      }
      &.commodityType0 {
        width: 153px;
        height: 129px;
        margin: 4px 0 4px 4px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      &.commodityType1 {
        width: 159px;
        margin: 10px 0;
        img {
          width: 100%;
        }
      }
      &.commodityType2 {
        width: 151px;
        margin: 4px;
        height: 83px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      &.commodityType3 {
        width: 153px;
        height: 130px;
        margin: 4px 0 4px 4px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      &.commodityType4 {
        width: 153px;
        height: 112px;
        margin: 4px 0 4px 4px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      &.commodityType8 {
        width: 153px;
        margin: 4px 0;
        height: 158px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      &.commodityType9 {
        width: 153px;
        margin: 4px 0;
        &.commodityType9:nth-child(1) {
          height: 238px;
        }
        &.commodityType9:nth-child(2) {
          height: 112px;
        }
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
  .lef {
    .el-form-item__label {
      text-align: left;
    }
  }

  /* 列表 */
  .magiccubestyleList {
    padding: 6px 12px;
    margin: 16px 0px;
    border-radius: 2px;
    background-color: #fff;
    box-shadow: 0 0 4px 0 rgba(10, 42, 97, 0.2);
    // display: flex;
    position: relative;

    /* 删除图标 */
    .el-icon-circle-close {
      position: absolute;
      right: -10px;
      top: -10px;
      cursor: pointer;
      font-size: 19px;
    }

    /* 图片 */
    .imag {
      width: 60px;
      border-radius: 5px;
      position: relative;
      cursor: pointer;
      .upvideo{
        padding: 10px 0;
        position: relative;
        p {
          position: absolute;
          left: 0;
          bottom: 0px;
          width: 60px;
          height: 20px;
          font-size: 12px;
          color: #fff;
          background: rgba(0, 0, 0, 0.5);
          text-align: center;
          line-height: 20px;
        }
        :hover{
          cursor: pointer;
        }
      }
      img {
        width: 100%;
        height: 100%;
        display: inline-block;
      }
      span {
        background: rgba(0, 0, 0, 0.5);
        font-size: 12px;
        position: absolute;
        left: 0px;
        bottom: 0px;
        display: inline-block;
        width: 100%;
        text-align: center;
        color: #fff;
        height: 20px;
        line-height: 20px;
      }
    }

    /* 图片字 */
    .imgText {
      width: 80%;
      display: flex;
      flex-direction: column;
      box-sizing: border-box;
      padding-left: 20px;
      justify-content: space-between;
    }
  }

  /* 列表样式 */
  .commodityType {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    width: 230px;
    img {
      display: inline-block;
      width: 30px;
      height: 25px;
      // text-align: center;
      // line-height: 32px;
      // background: #fff;
      border: 1px solid #ebedf0;
      // color: #979797;
      margin: 0 1px;
      cursor: pointer;
      transition: all 0.5s;
      margin-bottom: 10px;
      &:hover {
        border: 1px solid #155bd4;
        color: #155bd4;
      }

      &.active {
        border: 1px solid #155bd4;
        background-color: #e0edff;
        color: #155bd4;
      }
    }
  }
}
</style>
